﻿@page "/"
@using System.IO;
<div class="main">
    <div class="container">
        <div class="intro">
            <div class="avatar">
                <a href="javascript:;"> <img src="@img" /></a>
            </div>
            <div class="nickname">ZtPlus</div>
            <div class="description">
                <p>
                    摸鱼怪
                   
                    @*生命不息，奋斗不止
                    <br>Cease to struggle and you cease to live*@
                </p>
            </div>
            <div class="links">
                <NavLink class="link-item" title="Posts" href="posts">
                    <i class="iconfont iconread"></i>
                </NavLink>
                <NavLink target="_blank" class="link-item" title="Notes" href="#">
                    <i class="iconfont iconnotes"></i>
                </NavLink>
                <NavLink target="_blank" class="link-item" title="API" href="#">
                    <i class="iconfont iconapi"></i>
                </NavLink>
                <NavLink class="link-item" title="Manage" href="/auth">
                    <i class="iconfont iconcode"></i>
                </NavLink>
                <NavLink target="_blank" class="link-item" title="Github" href="https://github.com/zt199510/MyBlog">
                    <i class="iconfont icongithub"></i>
                </NavLink>
                <NavLink class="link-item weixin" title="扫码关注微信公众号：『ZtPlus』查看更多。" @onmouseover="Hover" @onmouseout="Hover">
                    <i class="iconfont iconweixin"></i>
                </NavLink>
                <div class="qrcode @QrCodeCssClass">
                      
                </div>
            </div>
        </div>
    </div>
</div>

@code{
    /// <summary>
    /// 是否隐藏
    /// </summary>
    private bool IsHidden = true;

    /// <summary>
    /// 二维码CSS
    /// </summary>
    private string QrCodeCssClass => IsHidden ? "hidden" : null;

    /// <summary>
    /// 鼠标移入移出操作
    /// </summary>
    private void Hover() => IsHidden = !IsHidden;

    List<string> fileslist = new List<string>();
    string path = $"{Directory.GetCurrentDirectory()}{@"\wwwroot\images"}";
    string img = "/images/logo.jpg";
    string imgNmae = "N/A";
    public void loadImages()
    {
        var flies = Directory.GetFiles(path);
        foreach (var item in flies)
        {
            fileslist.Add(Path.GetFileName(item));
        }
    }

    public void ReadFile(string fileName)
    {
        imgNmae = fileName.Split('.')[0];
        img = "/images/" + fileName;
    }

}